/**
 * Created by hasee on 2017/7/4.
 */
var express = require('express');
var  path = require('path');
var bodyParser = require('body-parser');
var serveStatic = require('serve-static');

var app = express();
//app.use('/app/img',serveStatic(__dirname + '/app/img'));
app.use('/public',serveStatic(__dirname + '/public'));
app.use(bodyParser.urlencoded({ extended: false }));
app.use(bodyParser.json({limit: '4MB'}));
app.get('/public/*', function (request, response){
    console.log(__dirname)
    response.sendFile(path.resolve(__dirname, 'public', 'index.html'))
})

app.get('/', function (req, res) {
    res.send('Hello World!');
});

var server = app.listen(8080, function () {

    var host = server.address().address;
    var port = server.address().port;

    console.log('Example app listening at http://%s:%s', host, port)

});